//== GAIA ============================================================================

//== BEGINNING OF CODE ===============================================================

#include "sagittarius/core/SagittariusCore.h"

#include <stdio.h>
//#include <malloc.h>
#include <assert.h>
#include "sagittarius/session/session.h"

sg_session ses; //stack explosion

int main(int argc, char* argv[])
{
    int i;
    sg_sclass c;
    sg_pageheap* ph;
    sg_span* s;
    size_t b;
    void *obj;
    
    //init
    init_session(&ses);
    
    c = 4;
    ph = &ses.smoheap.heaps[c-1];
    s = &ph->spans[0];
    b = s->bs;
    printf("block size = %lu, object bytes = %lu\n", b, sg_sc_nbytes(c));
    obj = sg_get_smo_addr(s->addr, s->freenode, b);
    span_dump_sate(1, s);
    //walk the list for this size class
    for(i=0; i<s->no; ++i, obj = sg_get_smo_addr(s->addr, sg_get_smo_header(obj, b), b)) {
        printf("Object at %p, next: %p\n", 
               obj,
               sg_get_smo_addr(s->addr, sg_get_smo_header(obj, b), b));
    }
    
    return 0;
}
